<?php
class RegisterPlus{

	public static $_self;
	protected $_dictograph;
	protected $_success = false;
	protected $_form;
	
	public static function Register(RegisterForm $form){
		if (!self::$_self instanceof self) {
			self::$_self = new self();
			//self::$_self->dictographBuild();
		}
		self::$_self->_form = $form;
		self::$_self->RegisterProcess();
		return self::$_self;
	}
	
	public function success(){
	    return $this->_success;
	}
	
	public function RegisterProcess(){
	    $this->_success = $this->_form->register();

	    //自动登录
	    
		if($this->_success){
		    $login_auth=new SysAuth();
		    $login_auth->id       = $this->_form->customerId;
		    $login_auth->username = $this->_form->user_name;
		    $loginplus=new LoginPlus();
		    $loginplus->register='register';

		    $loginplus->Login($login_auth);

		}
	}
	/*
	protected function dictographBuild(){
		$dictograph = $this->dictograph();
		foreach ($dictograph as $class => $path){
			if(!class_exists($class)){
				Yii::import($path);
				$this->_dictograph[$class] = new $class();
			}
		}
	}
	

	public function dictograph(){
		return array(
			
		);
	} 
	*/
	
}